package com.situ.blog.controller;

import com.situ.blog.pojo.Blog;
import com.situ.blog.service.IBlogService;
import com.situ.blog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private IBlogService blogService;

    @RequestMapping("/toBlogList")
    public String toBlogList() {
        return "blog_list";
    }

    @RequestMapping("/list")
    @ResponseBody
    public Result list() {
        List<Blog> list = blogService.list();
        return Result.ok(list);
    }


}
